package com.wanrue.tcc.core;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Pointcut;

/**
 * tcc 切面
 * Created by wenjie on 10/15/18.
 */
public abstract class TransactionAspect {


    private TransactionInterceptor transactionInterceptor;

    public void setTransactionInterceptor(TransactionInterceptor transactionInterceptor) {
        this.transactionInterceptor = transactionInterceptor;
    }

    @Pointcut("@annotation(com.wanrue.tcc.annotation.Tcc)")
    public void tcc() {
    }

    @Around("tcc()")
    public Object interceptTccMethod(ProceedingJoinPoint pjp) throws Throwable {
        return transactionInterceptor.interceptTccMethod(pjp);
    }

    public abstract int getOrder();

}